package com.zyf.springcloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyf.springcloud.dao.PermissionDao;
import com.zyf.springcloud.model.Permission;
import com.zyf.springcloud.result.Result;
import com.zyf.springcloud.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PermissionServiceImpl extends ServiceImpl<PermissionDao, Permission> implements PermissionService {
    @Autowired
    PermissionDao permissionDao;
    public Object getAll(){
        return permissionDao.selectList(null);
    }
    public int selectPermissionIdByPermissionURL(String URL){
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("url",URL);
        Permission permission = permissionDao.selectOne(queryWrapper);
        if (permission==null){
            //没有这个url
            return 0;
        }
        return permission.getId();
    }
}
